feat(search-api-graphql): write the GraphQL contract of a schema module to a file - #722
Merged
Conversation
- add optionalObjectExport to @lde/search/module: reads an optional object-shaped export of a loaded schema module, naming the module and the export when it is not a plain object - have @lde/search-api-server use it for schemaOptions and engineOptions instead of its own copy, so the two cannot drift apart - re-anchor the branch baselines the deleted copy carried
…le to a file - add printSchemaModuleSdl on a @lde/search-api-graphql/print-sdl entry point: loads a mounted schema-declaration module the way the indexer and the served API load it, forwards its schemaOptions, and prints the SDL. A separate entry point because it reads the filesystem, while the main one stays runtime-agnostic - expose it as the search-print-sdl bin, so a deployment regenerates and commits its published surface without a script of its own - format with the Prettier configuration that applies to the output path, .editorconfig included, so a formatting pre-commit hook and this writer cannot spell the same schema differently and overwrite each other in turn. Prettier is an optional peer: the consumer's own version formats the file, and --no-format never loads it - name the graphql parser outright, so an output path Prettier cannot map to a parser formats instead of failing - resync package-lock.json, which carries version drift from earlier releases beyond the dependencies added here
ddeboer
force-pushed
the
feat/print-sdl-bin
branch
from
August 12, 2026 14:04
c63761e to
4abf010
Compare
This was referenced Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A deployment that mounts a schema-declaration module usually wants its GraphQL
contract as a published file –
schema.graphql, the thing consumers readand pull requests diff. Today each such repository writes that generator
itself; Linked Open Limburg has one, and it is generic apart from its paths.
This moves it here.
search-print-sdlLoads the module through
loadSchemaModulefrom@lde/search/module– thesame loader, the same validation and the same
schemaOptionsforwarding theindexer and the served API use – so the printed file cannot describe a
different API from the one served. Without
--outthe SDL goes to standardoutput.
printSchemaModuleSdlis the same thing from code, on a@lde/search-api-graphql/print-sdlentry point rather than the barrel: itreads the filesystem, and the main entry point stays runtime-agnostic for
consumers bundling the fetch handler for workers or the edge (mirroring how
@lde/searchkeepsloadSchemaModuleon/module).Formatting
The output is formatted with the Prettier configuration that applies to the
output path,
.editorconfigincluded – the Prettier CLI reads it by defaultand the Node API does not, so leaving it off would have a repository’s
prettier --writepre-commit hook reformat what was just written, the twooverwriting each other in turn and producing a permanent spurious diff in the
regenerate-and-commit workflow. The
graphqlparser is named outright, so anoutput path Prettier cannot map to a parser (
.sdl) formats instead of failing.Prettier is an optional peer dependency: the consumer’s own version formats
the file, which is the point – a bundled copy at another version could reopen
the same ping-pong – and it stays out of the
@lde/search-api-serverimage.--no-formatnever loads it.Also here
@lde/search-api-servervalidated its optional module exports with its owncopy of a check this writer needed too. That check now lives once, as
optionalObjectExportin@lde/search/module, next to the loader that handsback the raw exports for consumers to validate.
Two coverage baselines move down: both packages are at 100% for every file
this touches, and the aggregate branch percentage drops only because the
deleted duplicate’s covered branches left the denominator.
Note on the lockfile
package-lock.jsoncarries ~60 lines beyond the dependencies added here:version drift
nx releaseleft behind by bumping package manifests withoutsyncing the lock. Any
npm installreproduces it; hand-editing it back out isriskier than the noise.